package pack

import (
	"mall_frontend_api/biz/model"
	"mall_frontend_api/biz/model/region"
)

func Region(data *model.Region) *region.Region {
	info := region.NewRegion()
	if data == nil {
		return info
	}
	info.ID = data.ID
	info.Name = data.Name
	info.Level = data.Level

	return info
}

func RegionList(data []*model.Region) []*region.Region {
	list := make([]*region.Region, 0)
	if len(data) == 0 {
		return list
	}
	for _, dd := range data {
		list = append(list, Region(dd))
	}
	return list
}
